package ibm.cognos.imt.template

import groovy.xml.MarkupBuilder

/**
 * Created with IntelliJ IDEA.
 * User: eric
 * Date: 5/15/14
 * Time: 2:13 PM
 * To change this template use File | Settings | File Templates.
 */
class CellTemplate extends AbstractTemplate{
    def content

    CellTemplate(c){
        content = c
    }

    @Override
    def generateTemplateSpec(MarkupBuilder builder) {
        builder.tableCell{
            contents()
        }
    }

    @Override
    def getTemplateNode() {
        root = new XmlSlurper().parseText(getSpecStr())
        if (content.size() > 0) {
            content.each{
                root.contents.appendNode(it.getDomNode())
            }
        }
        root
    }
}